<?php


namespace App\Common;


class Response
{
    const CODE_OK = 200;

    const MESSAGE_SUCCESS = '成功';

    public static function json(int $code = self::CODE_OK, string $message = self::MESSAGE_SUCCESS, array $data = [])
    {
        return response()->json(compact('code', 'message', 'data'));
    }

    public static function success(array $data = [])
    {
        return self::json(self::CODE_OK, self::MESSAGE_SUCCESS, $data);
    }
}
